<#assign module="driver"/>

<@override name="header">
</@override>
<@override name="body">
<div class="row">
	<div class="col-xs-6" style="width:47%;">
	  	<div class="btn-group">
		  <a class="btn btn-default active" href="${ctx}/driver/list">全部</a>
		  <a class="btn btn-default" href="${ctx}/driver/lesslist">余额少于${Func.getLowestWorkVirtual()}</a>
		  <a class="btn btn-default" href="${ctx}/driver/freezelist">已冻结</a>
		  <a class="btn btn-default" href="${ctx}/driver/recordlist">通话记录</a>
		  <@shiro.hasPermission name='driverapply'>
		  	<a class="btn btn-default" href="${ctx}/driverapply/list">服务人员审核</a>
		  </@shiro.hasPermission>
		  <@shiro.hasPermission name='rate'>
		  	<a class="btn btn-default" href="${ctx}/rate/list">服务人员评价</a>
		  </@shiro.hasPermission>
		</div>
  	</div>
  	
  <div class="col-xs-4" style="width:39%;">
  	<form class="form-inline" role="form">
  		<div class="form-group">
		    <input type="text" class="form-control" name="param" value="${param?if_exists}"  placeholder="输入账号、姓名、手机">
	  	</div>
	  	<select class="form-control" name="status">
  			<option value="">状态</option>
  			<option value="1" <#if status?? && status==1>selected="selected"</#if>>上线</option>
  			<option value="2" <#if status?? && status==2>selected="selected"</#if>>接单</option>
  			<option value="3" <#if status?? && status==3>selected="selected"</#if>>忙碌</option>
  			<option value="0" <#if status?? && status==0>selected="selected"</#if>>下线</option>
  		</select>
  		<select class="form-control" name="type">
  			<option value="">员工类型</option>
  			<option value="0" <#if type?? && type==0>selected="selected"</#if>>兼职</option>
  			<option value="1" <#if type?? && type==1>selected="selected"</#if>>全职</option>
  		</select>
	  	<button type="submit" class="btn btn-default"><i class="icon-search"></i>&nbsp;搜索</button>
  	</form>
  </div>
  
  <div class="col-xs-2" style="width:14%;">
  		<button class="pull-right button button-rounded button-flat-blue" onclick="window.location='${ctx}/driver/add';"><i class="icon-plus"></i>&nbsp;添加新服务人员</button>
  </div>
</div>
<div class="row margin-top">
	<div class="col-xs-12">
	<div class="panel panel-primary">
		<div class="table-responsive">
		<table class="table table-hover table-striped">
			<thead>
			<tr style="font-size:14px;">
				<th>真实姓名</th>
				<th>昵称</th>
				<th>工号</th>
				<th>手机号</th>
				<th>余额</th>
				<th>员工类型</th>
				<th>提成方式</th>
				<th>状态</th>
				<th>APP版本</th>
				<th>所属公司</th>
				<th>上传时间</th>
				<th>推送状态</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
			  	<#list page.content as data>
					<tr>
						<td>${data.realname?if_exists}</td>
						<td>${data.name?if_exists}</td>
						<td>${data.username?if_exists}</td>
						<td>${data.phone?if_exists}</td>
						<td><span style="color:#ff950b;font-weight:700;">${data.virtual?if_exists}</span></td>
						<td>${data.type?if_exists}</td>
						<td>
							<#if data.driverLevel??>
								${data.driverLevel.name?if_exists}
							<#else>	
								无
							</#if>
						</td>
						<td>
							<#if data.isFreeze>
								<b><span style="color:#4864B0">冻结</span></b>
							<#else>
								<#if data.status==0>
									<span style="color:#999999">下线</span>
								<#elseif data.status==1>
									<span style="color:#059405;font-weight:700;">空闲</span>
								<#elseif data.status==2>
									<span style="color:#db871b;font-weight:700;">接单</span>
								<#elseif data.status==3>
									<span style="color:#b40000;font-weight:700;">忙碌</span>
								</#if>
							</#if>
						</td>
						<td>
							<#if data.appVersion??>
								${data.appVersion}
							<#else>
								未登陆
							</#if>
						</td>
						<td>${data.company.abbreviation?if_exists}</td>
						<td>
							<#if data.posUpdated??>
								${data.posUpdated?string('MM/dd HH:mm:ss')}
							<#else>
								未上传
							</#if>
						</td>
						<td>
							<#if data.userID??>
								<a href="javascript:;" class="getGtStatus" data-value="${data.userID?if_exists}">点击获取</a>
							</#if>
						</td>
						<td style="max-width:230px;">
							<a href="${ctx}/driver/edit/${data.id}" class="btn-link">编辑</a>
							<@shiro.hasPermission name='driverdelete'>
							<a href="javascript:;" data-value="${data.id}" class="btn-link deletethis">删除</a>
							</@shiro.hasPermission>
							<#if data.isFreeze>
								<a href="javascript:;" data-value="${data.id}" class="btn-link jiedongthis">解冻</a>
							<#else>
								<a href="javascript:;" data-value="${data.id}" class="btn-link dongjiethis">冻结</a>
							</#if>
							<a href="javascript:;" data-value="${data.id}" data-value-name="${data.name}" class="btn-link passwordthis">改密码</a>
							<@shiro.hasPermission name='drivermoney'>
							<a href="${ctx}/driver/money/${data.id}" class="btn-link">充值</a>
							</@shiro.hasPermission>
							<a href="${ctx}/driver/inandout/${data.id}" class="btn-link">消费历史</a>
							<#if data.udid?? && (data.udid?length>0)>
								<a href="javascript:;" data-value="${data.id}" class="btn-link jiebangthis">解绑</a>
							</#if>
							<#if data.status==0>
								<a href="javascript:;" data-value="${data.id}" class="btn-link onlinethis">上线</a>
							<#else>
								<a href="javascript:;" data-value="${data.id}" class="btn-link powerofflinethis">强制下线</a>
							</#if>
							<#if data.appVersion??>
								<#if data.deviceType?? && data.deviceType=="3">
									<a href="javascript:;" data-value="${data.id}" class="btn-link deviceInfo">设备信息</a>
								</#if>
							</#if>
							<@shiro.hasPermission name='rate'>
								<a href="${ctx}/rate/listByDriver/${data.id}" class="btn-link">评价</a>
							</@shiro.hasPermission>
						</td>
					</tr>
				</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/driver/list2">
				<@pg.param name="param" value="${param?if_exists}"/>
				<@pg.param name="status" value="${status?if_exists}"/>
				<@pg.param name="type" value="${type?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>


<div class="modal" id="dialog_password">
  <div class="modal-dialog" style="top:150px;">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close close_modal" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">修改<span id="dialog_whose"></span>的密码（新密码将通过短信告知服务人员）</h4>
      </div>
      <div class="modal-body">
      	<div class="form-horizontal">
	        <div class="form-group">
	            <label class="col-sm-3 control-label"><em style="color:red">*</em>新密码：</label>
	            <div class="col-sm-5">
	            	<input class="form-control" id="password" type="password"  required>
	        	</div>
	        </div>
	        <div class="form-group">
	            <label class="col-sm-3 control-label"><em style="color:red">*</em>确认密码：</label>
	            <div class="col-sm-5">
	            	<input class="form-control" id="passwordconfirm" type="password"  required>
	        	</div>
	        </div>
	    </div>
      </div>
      <div class="modal-footer">
    	<button type="button" class="btn btn-primary" id="ok_modal">确定</button>
    	<button type="button" class="btn btn-default close_modal">取消</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div>

<div id="dialog_deviceInfo" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close close_modal" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">设备信息</h4>
      </div>
      <div class="modal-body">
      	<div id="deviceInfo_loading_div">
      		<center><i class="icon-spinner icon-spin icon-large"></i> &nbsp; 获取中...</center>
      	</div>
      	<div id="deviceInfo_complete_div" style="display:none;">
	      	<div class="form-group">
	            <label>手机型号：</label>
	            <span id="mobileVersion_span"></span>
	        </div>
	        <div class="form-group">
	            <label>系统版本：</label>
	            <span id="systemVersion_span"></span>
	        </div>
	        <div class="form-group">
	            <label>wifi：</label>
	            <span id="wifi_span"></span>
	        </div>
	        <div class="form-group">
	            <label>gps：</label>
	            <span id="gps_span"></span>
	        </div>
	        <div class="form-group">
	            <label>后台运行：</label>
	            <span id="runningBackground_span"></span>
	        </div>
	        <div class="form-group">
	            <label>root：</label>
	            <span id="root_span"></span>
	        </div>
	        <div class="form-group">
	            <label>网络类型：</label>
	            <span id="networkType_span"></span>
	        </div>
	        <div class="form-group">
	            <label>运营商：</label>
	            <span id="operatorName_span"></span>
	        </div>
        </div>
      </div>
    </div>
  </div>
</div>

</@override>



<@override name="footer">
	<script type="text/javascript">
		<#if smsMessage??>
			$.scojs_message("服务人员密码短信发送失败，错误代码${smsMessage}", $.scojs_message.TYPE_ERROR);
		</#if>
	</script>
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
	</script>
	<script src="${ctx}/assets/js/driver.js"></script>
</@override>
<@extends name="../layout.ftl"/>